package com.stars.home.vmodel

import android.app.Application
import android.graphics.Color
import android.text.TextUtils
import android.view.View
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.hwangjr.rxbus.RxBus
import com.stars.home.config.ConfigRx
import com.stars.home.model.MemberListTo
import com.stars.home.model.User
import com.stars.home.utils.net.NetEngine
import com.trailer.base.base.BRRepository
import com.trailer.base.base.BRViewModel
import com.trailer.base.net.IResp
import kotlinx.coroutines.launch

/**
 *
 *on 2020/9/25
 */
class BillVModel(application: Application) : BRViewModel<BRRepository>(application) {


    var timeType:String?="0"
    var time:String?=""
    var type:String?="0"

    var bean=MutableLiveData<MemberListTo>()


    fun setTips(money:String?,type:String?):String{
        if(type.equals("2")||type.equals("3")){
            return "-$money"
        }
        return "+$money"
    }


    fun getCount(){

        viewModelScope.launch {
            var it=NetEngine.service.memberAccountTo(timeType,type,time,10, repository().page)
            if(it.ok()){
                bean.value=it.data
            }
        }
    }


    override fun apiFunc(): suspend () -> IResp<*> {
        return { NetEngine.service.memberAccount("2",timeType,type,time,10, repository().page) }
    }





}
